/**
 * 预约参数
 */
const reservation_Parameter = {
  accommodation_id: 0,
  start_time: "",
  end_time: "",
};
/**
 * 收藏参数
 */
const save_Accommodation_Parameter = {
  accommodation_id: 0,
  accommodation_uid: 0,
};
/**
 * 住宿参数
 */
const accommodation_Parameter = {
  name: "",
  facilities: "",
  other_facilities: "",
  charge: "",
  people_ceiling: 0,
  bed_ceiling: 0,
  house_type: "",
  rental_type: "",
  house_pattern: "",
  description: "",
  surrounding_area: "",
  location: "",
  requirement: "",
  images: "",
};
/**
 * 文章参数
 */
const article_Parameter = {
  article_id: "",
  article_uid: "",
};

/**
 * 发布文章参数
 */
const releaseArticle_Parameter = {
  title: "",
  summary: "",
  body: "",
  category_id: 0,
  type: "",
  cover1: "",
  cover2: "",
  cover3: "",
};

/**
 * 分页数据参数
 */
const paging_Parameter = {
  limit: "",
  offset: "",
};

/**
 * 发布活动的参数
 */
const releaseActivity_Parameter = {
  activity_title: "",
  activity_describe: "",
  activity_classify: 0,
  activity_place: "",
  activity_cover: "",
  people_ceiling: 0,
  start_time: "",
  end_time: "",
};

/**
 * 图片上传路径的文件夹
 */
// const fileSavePath = "Avatar" | "Activity" | "Community" | "Banners";
const fileSavePath = ["Avatar", "Activity", "Community", "Banners"];

/**
 * 判断一个对象中的所有key在另一个对象中是否存在
 * @param {*} obj1 需要的参数
 * @param {*} obj2 传递的参数
 * @returns 返回空数组 或者 所有缺少参数组成的数组
 */
function getMissingKeys(obj1, obj2) {
  // console.log("obj1, obj2", obj1, obj2);

  // 可以获取一个对象的所有键，并返回一个包含这些键的数组
  const keyObj1 = Object.keys(obj1);

  // every 对数组中的每个元素都执行一次该回调函数。回调函数返回布尔值。如果对于每个元素，回调函数都返回 true，
  // some 一真即真； every 一假即假
  //   const result = keyObj1.every((key) => keyObj2.includes(key))

  //   使用 filter() 方法对每个键进行过滤。过滤条件是：obj2 不具有该键
  return keyObj1.filter((key) => !obj2.hasOwnProperty(key));
}

module.exports = {
  paging_Parameter,
  releaseActivity_Parameter,
  releaseArticle_Parameter,
  article_Parameter,
  fileSavePath,
  getMissingKeys,
  accommodation_Parameter,
  save_Accommodation_Parameter,
  reservation_Parameter,
};
